#include<bits/stdc++.h>
using namespace std;

char c, older=0;
bool iserror=false,isend=false;
int in=0;

inline bool isop(char c){ return (c=='+'||c=='-'||c=='*'||c=='/')?true:false; }

void compose(queue<double> &num,queue<bool> &op){
    double temp;
    while(!op.empty()){
        temp=num.front();
        num.pop();
        if(op.front()) num.front()*=temp;
        else num.push(temp);
        op.pop();
    }
    while(!num.empty()){
        temp=num.front();
        num.pop();
        if(num.empty()){
            num.push(temp);
            break;
        }
        num.front()+=temp;
    }
}

inline double ans(double x, int times, pair<bool,bool> PT){
    for(int i=1;i<=times;i++) x/=10;
    if(!PT.first) return -x;
    else if(!PT.second) return 1/x;
    else return x;
}

inline void init(double &x,int & times, pair<bool ,pair<bool,bool> > &situ){
    x=times=0; situ.first=false;
    situ.second.first=situ.second.second=true;
}

double cal(){
    in++;
    if(isend) return 0;

    queue<double> num; queue<bool> op;
    pair<bool ,pair<bool,bool> > situ;//<isfra,isp,isti>
    pair<bool,bool> & PT=situ.second;
    double x; int times;
    init(x,times,situ);

    while(1){
        if(isend) break;
        c=getchar();
        if(older){
            if(isop(older)) {if(isop(c)||c=='.'||c==')'||c=='\n') {iserror=true; }}
            else if(older=='.') {if(isop(c)||c=='.'||c==')'||c=='\n') {iserror=true; }}
            else if(older=='(') {if(isop(c)&&c!='-'||c=='.'||c==')'||c=='\n') {iserror=true; }}
            else if(older>='0'&&older<='9') {if(c=='(') {iserror=true; }}
            else if(older==')') {if(c>='0'&&c<='9'){iserror=true; }}
        }else if((isop(c)&&c!='-')||c=='.'||c==')'||c=='\n') {iserror=true; }
        older=c;

        if(c=='('){
            x=cal();
        }else if(c==')'||c=='\n'||c==255||c==-1){
            in--; if(c!=')') isend=true;
            num.push(ans(x,times,PT));
            compose(num,op);
            return num.front();
        }else if(c>='0'&&c<='9'){
            x=x*10+(c-'0');
            if(situ.first) times++;
        }else if(c=='.'){
            if(situ.first){
                iserror=true;
            }else situ.first=true;
        }
        else if(isop(c)){
            num.push(ans(x,times,PT));
            init(x,times,situ);
            if(c=='-') PT.first=false;
            else if(c=='/') PT.second=false;
            else ;
            if(c=='+'||c=='-') op.push(false);
            else op.push(true);
        }
    }
    return 0;
}

int main(){
    while(1){
        iserror=false; isend=false; in=0;
        double answer=cal();
        if(iserror||!isend||in) cout<<"Error!"<<endl;
        else cout<<answer<<endl;
        int k=(int)c;
        if(k==255||k==-1) break; 
    }
}